package com.bayi.storage.utils;

import android.view.Gravity;
import android.widget.Toast;

import com.bayi.storage.base.BaseApplication;

/**
 * Created by guoping on 16/9/5.
 */
public class ToastUtil {

    private static ToastFormat format;

    public static void show(final String msg) {
        ThreadUtil.runOnUI((Runnable) () -> {
            try {
                if (format == null) {
                    format = new ToastFormat(BaseApplication.getApp());
                    format.InitToast();
                    format.setGravity(Gravity.CENTER);
                }
                format.setText(msg);
                format.show();
            } catch (Exception e) {
                e.printStackTrace();
            }
        });
    }
}
